<template>
	<view class="app_Cont">
		<view class="showCont" v-if="showCont">
			<view class="smgCont">
				<view class="msgItem" @click="detailFn(item)" :key="index" v-for="(item,index) in listArr">
					<view class="msgName">{{item.article_title}}</view>
					<view class="msgCont textWrap">
						{{getInfoText(item.article_content)}}
					</view>
					<view class="msgUnder">
						<view class="msgTime">{{item.create_time}}</view>
						<view class="moreText">查看详情</view>
					</view>
				</view>
			</view>
		</view>
		<load v-if="!showCont||isChange"></load>
	</view>
</template>

<script>
	import api from '@/http/api.js'
	import load from '@/components/load.vue'
	import converData from "@/utils/converData";
	export default {
		components:{load},
		data() {
			return {
				listArr:[],
				page:1,
				per_page:3,
				getInfoText:converData.changeLine,
				showCont:false,
				isChange:false,
				last_page:0,
			};
		},
		methods:{
			detailFn(item){
				uni.navigateTo({
					url: 'noticeDetail/noticeDetail?id='+item.article_id
				});
			},
			getData(){
				let data = {
					page:this.page,
					per_page:this.per_page,
				}
				api.getRequst(data,'/api/My/artData').then((res)=>{
					if(res.code==1){
						let arr = res.data.data
						for(let item of arr){
							this.listArr.push(item)
						}
						this.last_page = res.data.last_page
					}
					this.showCont = true
					this.isChange = false
				})
			},
		},
		onLoad() {
			this.getData()
		}
	}
</script>

<style lang="less">
.showCont{
	min-height: 100vh;
	padding-bottom:30rpx;
	box-sizing: border-box;
	padding-top: 30rpx;
	.smgCont{
		width: 100%;
		padding: 0 4%;
		box-sizing: border-box;
		.msgItem{
			width: 100%;
			border-radius: 15rpx;
			padding: 30rpx 4%;
			box-sizing: border-box;
			background-color: #fff;
			margin-bottom: 30rpx;
			.msgName{
				font-size: 28rpx;
				font-weight: bold;
				text-align: center;
				padding-bottom: 30rpx;
			}
			.msgCont{
				text-indent: 52rpx;
				font-size: 26rpx;
				color: #333;
				line-height: 38rpx;
				display: -webkit-box;
				-webkit-box-orient: vertical;
				-webkit-line-clamp: 3; /* 定义文本的行数 */
				overflow: hidden;
				text-overflow: ellipsis;
			}
			.msgUnder{
				display: flex;
				justify-content: space-between;
				align-items: center;
				padding-top: 30rpx;
				border-top: 1px dashed #ddd;
				margin-top: 30rpx;
				color: #333;
				.moreText{
					color: #3f55cc;
				}
			}
		}
	}
}
</style>
